package com.lipaluma.field.merge;

/**
 * Basic interface for a merge algorithm that allows only unmerge
 * @author mario.soares
 */
public interface FieldMergedAlgorithm {
	/**
	 * name of the node <code>&lt;merge></code> in the xml file configuration
	 */
	public static final String MERGE_NODE_NAME = "merge";
	/**
	 * name of the node <code>&lt;customMerge></code>in the xml file configuration
	 */
	public static final String CUSTOM_MERGE_NODE_NAME = "customMerge";
	
	/**
	 * used to merge values and will return the value merged
	 * @param oldValue the first value encountered
	 * @param valueToAdd the new value to merge
	 * @param params external parameters
	 * @return the value merged
	 */
	Object merge(Object oldValue, Object valueToAdd, String... params);

	/**
	 * used to unmerge a value.
	 * @param value the value to unmerge
	 */
	Object[] unmerge(Object value);
}
